package cn.virens.web.components.spring.permission;

import java.io.Serializable;

public class PermissionParam implements Serializable {
	private static final long serialVersionUID = 3040167937850959007L;
	private Integer role;
	private Integer resource;

	private Boolean view;
	private Boolean manage;

	public Integer getRole() {
		return role;
	}

	public void setRole(Integer role) {
		this.role = role;
	}

	public Integer getResource() {
		return resource;
	}

	public void setResource(Integer resource) {
		this.resource = resource;
	}

	public Boolean getManage() {
		return manage;
	}

	public void setManage(Boolean manage) {
		this.manage = manage;
	}

	public Boolean getView() {
		return view;
	}

	public void setView(Boolean view) {
		this.view = view;
	}

	public String getPermission() {
		if (view && manage) {
			return "view,manage";
		} else if (!view && manage) {
			return "manage";
		} else if (view && !manage) {
			return "view";
		} else {
			return "";
		}
	}

	@Override
	public String toString() {
		return getPermission();
	}

}
